import request from '@/utils/request'

// 机构列表
export function merchantList(query) {
  return request({
    url: '/jbl-business/api/admin/v1/business/select/page',
    method: 'get',
    params: query
  })
}

// 更改机构状态
export function merchantStatus(query) {
  return request({
    url: '/jbl-business/api/admin/v1/business/dismountGrounding',
    method: 'get',
    params: query
  })
}

// 机构详情
export function merchantDetail(query) {
  return request({
    url: '/jbl-business/api/admin/v1/business/getById',
    method: 'get',
    params: query
  })
}

// 机构分类
export function merchantType(query) {
  return request({
    url: '/jbl-business/api/v1/category/getByParentId',
    method: 'get',
    params: query
  })
}

// 机构所有分类
export function merchantAllType(query) {
  return request({
    url: '/jbl-business/api/v1/category/getCategoryAll',
    method: 'get',
    params: query
  })
}

// 机构更新
export function merchantUpdate(data) {
  return request({
    url: '/jbl-business/api/admin/v1/business/updateById',
    method: 'post',
    data
  })
}

// 添加机构
export function merchantAdd(data) {
  return request({
    url: '/jbl-business/api/admin/v1/business/add',
    method: 'post',
    data
  })
}

// 获取所有标签
export function getAllLabels(query) {
  return request({
    url: '/jbl-business/api/admin/v1/label/getByConditions',
    method: 'get',
    params: query
  })
}

// 获取机构对应的课程
export function merchantCourseList(query) {
  return request({
    url: '/jbl-business/api/admin/v1/business/getCourseByBusinessId',
    method: 'get',
    params: query
  })
}

// 下架机构课程
export function merchantCourseDown(query) {
  return request({
    url: '/jbl-course/api/admin/v1/course/down',
    method: 'get',
    params: query
  })
}

// 上架机构课程
export function merchantCourseUp(query) {
  return request({
    url: '/jbl-course/api/admin/v1/course/up',
    method: 'get',
    params: query
  })
}

// 查询单个课程（含协议和套餐）
export function getBoById(query) {
  return request({
    url: '/jbl-course/api/merchant/v1/course/getBoById',
    method: 'get',
    params: query
  })
}

// 修改课程（含协议和套餐）
export function updateCourse(query) {
  return request({
    url: '/jbl-course/api/merchant/v1/course/update',
    method: 'post',
    data: query
  })
}

// 未审核机构列表
export function merchantVerifyList(query) {
  return request({
    url: '/jbl-business/api/admin/v1/business/select/underReview',
    method: 'get',
    params: query
  })
}

// 机构审核状态更改
export function merchantVerifyStatus(data) {
  return request({
    url: '/jbl-business/api/admin/v1/certify/toExamine',
    method: 'post',
    data
  })
}

// 机构审核状态详情
export function merchantVerifyDetail(query) {
  return request({
    url: '/jbl-business/api/admin/v1/certify/getBusinessId',
    method: 'get',
    params: query
  })
}

// 用户列表
export function userList(query) {
  return request({
    url: '/jbl-user-center/api/admin/v1/account/pageList',
    method: 'get',
    params: query
  })
}

// 用户状态更改
export function userStatus(query) {
  return request({
    url: '/jbl-user-center/api/admin/v1/account/updateStatus',
    method: 'get',
    params: query
  })
}

// 用户详情
export function userDetail(query) {
  return request({
    url: '/jbl-user-center/api/admin/v1/account/getById',
    method: 'get',
    params: query
  })
}

// 用户订单列表
export function userOrderList(query) {
  return request({
    url: '/jbl-order/api/admin/v1/order/getMobileListPage',
    method: 'get',
    params: query
  })
}

// 家会员列表
export function getMemberList(query) {
  return request({
    url: '/jbl-user-center/api/admin/v1/sysMember/pageList',
    method: 'get',
    params: query
  })
}

// 启用或禁用
export function handleStatus(query) {
  return request({
    url: '/jbl-user-center/api/admin/v1/sysMember/updateStatus',
    method: 'get',
    params: query
  })
}

// 导出家会员模块
export function exportMemberList(query) {
  return request({
    url: '/jbl-user-center/api/admin/v1/sysMember/export',
    method: 'get',
    params: query
  })
}

// 用户推广码
export function QRcode(query) {
  return request({
    url: 'jbl-user-center/api/admin/v1/account/QRcode',
    method: 'get',
    params: query
  })
}

// 设置参与活动的机构
export function isJoinaActivity(query) {
  return request({
    url: '/jbl-business/api/admin/v1/business/updateJoinStatus',
    method: 'get',
    params: query
  })
}

// 编辑商户营业执照和法人身份证
export function editBusinessImgInfo(data) {
  return request({
    url: '/jbl-business/api/admin/v1/certify/updateById',
    method: 'post',
    data
  })
}
